package com.onlyphoto.onlymall.mvp.presenter

import android.content.Context
import com.onlyphoto.onlymall.base.BaseNetworkResponse
import com.onlyphoto.onlymall.base.BaseObserver

import com.onlyphoto.onlymall.mvp.contract.CMain
import com.onlyphoto.onlymall.mvp.model.MMainImpl
import com.onlyphoto.onlymall.base.BasePresenter
import com.onlyphoto.onlymall.bean.TabbarListBean


class PMainImpl(mContext: Context, mView: CMain.IVMain) : BasePresenter<CMain.IVMain, MMainImpl>(mContext, mView, MMainImpl()), CMain.IPMain {
    override fun requestData() {
        mModel.requestData(object : BaseObserver<TabbarListBean>(mContext.get()){
            override fun onSuccess(data: TabbarListBean?, msg: String?) {

            }

            override fun onCodeError(t: BaseNetworkResponse<TabbarListBean>?) {
                mView.defaultView()
            }

            override fun onFailure(e: Throwable?) {
                mView.defaultView()
            }

            override fun onRequestStart() {
                mView.showLoading()
            }

            override fun onFinally() {
                mView.hideLoading()
            }

        })
    }
}
